package com.prs.crm.domain.official;

import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.BaseEntity;
import com.prs.crm.domain.hr.Person;

/**
 * OA已收短消息
 * @author yanghao 2012-8-23 17:53:41
 *
 */
@Entity
@Table(name="official_shortmessagereceive")
public class ShortMessageReceive extends BaseEntity{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Integer id;
	
	private Integer shortMessageId;//对应发送信息的ID 
	@OneToOne
	private Person sendPerson;  //发送人
	@OneToOne
	private Person receivePerson;  //接收人
	
	private String state;  //是否已读
	
	private Integer oabox;  //0表示已收藏，1表示已收新闻
	private String title;  //标题
	@Lob
	private String content;  //内容
	private String degree;  //重要程度
	@ManyToOne(fetch=FetchType.LAZY)
	@Cascade(CascadeType.REFRESH)
	private Attachment attach; //文件
	@OneToMany(fetch=FetchType.LAZY,mappedBy="shortMessageReceive")
	@Cascade({org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.DELETE_ORPHAN})
	private Set<ShortMessageCollect> shortMessageCollects; 
	public Set<ShortMessageCollect> getShortMessageCollects() {
		return shortMessageCollects;
	}
	public void setShortMessageCollects(
			Set<ShortMessageCollect> shortMessageCollects) {
		this.shortMessageCollects = shortMessageCollects;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public String getDegree() {
		return degree;
	}
	public void setDegree(String degree) {
		this.degree = degree;
	}
	public Attachment getAttach() {
		return attach;
	}
	public void setAttach(Attachment attach) {
		this.attach = attach;
	}
	public Integer getShortMessageId() {
		return shortMessageId;
	}
	public void setShortMessageId(Integer shortMessageId) {
		this.shortMessageId = shortMessageId;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	
	public Person getSendPerson() {
		return sendPerson;
	}
	public void setSendPerson(Person sendPerson) {
		this.sendPerson = sendPerson;
	}
	public Person getReceivePerson() {
		return receivePerson;
	}
	public void setReceivePerson(Person receivePerson) {
		this.receivePerson = receivePerson;
	}
	public String getState() {
		return state;
	}
	public void setState(String state) {
		this.state = state;
	}
	public Integer getOabox() {
		return oabox;
	}
	public void setOabox(Integer oabox) {
		this.oabox = oabox;
	}
	
}
